package com.cike.productmanager;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.cike.productmanager.util.DataApplication;

public class ReadConContent extends Activity {

	private TextView readstorename;
	private TextView readconnum;
	private TextView readstarttime;
	private TextView readendtime;
	private TextView importance;
	private TextView type;
	private TextView content;
	
	private Button displayguidebutton;
	private Button relationbutton;
	
	private Button feedbackbutton;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.readcontract);
		
		Intent intent=getIntent();
        final int ID= intent.getIntExtra("ID", 0);
		
		
		readstorename=(TextView)findViewById(R.id.readstorename);
		readconnum=(TextView)findViewById(R.id.readconnum);
		readstarttime=(TextView)findViewById(R.id.readstarttime);
		readendtime=(TextView)findViewById(R.id.readendtime);
		importance=(TextView)findViewById(R.id.importance);
		type=(TextView)findViewById(R.id.type);
		content=(TextView)findViewById(R.id.content);
		
		displayguidebutton=(Button)findViewById(R.id.displayguidebutton);
		relationbutton=(Button)findViewById(R.id.relationbutton);
		feedbackbutton=(Button)findViewById(R.id.feedbackbutton);
		
		
		feedbackbutton.setOnClickListener(new View.OnClickListener() {
			
			/*以后在这里加入需要的门店信息传值，intent传值传一个ID，然后在CheckContract
     	       中从ID获取数据库信息*/
			@Override
			public void onClick(View v) {
				
				Intent intent = new Intent (ReadConContent.this,CheckContract.class);
				
				//传递排序过去
				intent.putExtra("ID", ID);
				
				startActivity(intent);
				
			}
		});
		
		String storename = ((com.cike.productmanager.adt.Contract)DataApplication.contractList.get(ID)).getStoreBelong();
		int connum = ((com.cike.productmanager.adt.Contract)DataApplication.contractList.get(ID)).getID();
		int imp = ((com.cike.productmanager.adt.Contract)DataApplication.contractList.get(ID)).getImportance();
		String startTime = ((com.cike.productmanager.adt.Contract)DataApplication.contractList.get(ID)).getStringStartTime();
        String endTime = ((com.cike.productmanager.adt.Contract)DataApplication.contractList.get(ID)).getStringEndTime();
        String contracttype = ((com.cike.productmanager.adt.Contract)DataApplication.contractList.get(ID)).getContactType();
        String contractcontent = ((com.cike.productmanager.adt.Contract)DataApplication.contractList.get(ID)).getContent();
		
		readstorename.setText(storename);
		//TODO 合同号暂时用 合同ID(数据库也这样设计最好)
		readconnum.setText(String.valueOf(connum));
		readstarttime.setText(startTime);
		readendtime.setText(endTime);
		importance.setText(String.valueOf(imp));
		type.setText(contracttype);
		content.setText(contractcontent);
	}
	
	
}
	
